/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.src.uniandes.ecos.tsp.creditscore.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author AndhyMao
 */
@Entity
@Table(name = "tbl_entidad_financiera")
@NamedQueries({@NamedQuery(name = "EntidadFinanciera.findAll", query = "SELECT e FROM EntidadFinanciera e"), @NamedQuery(name = "EntidadFinanciera.findByEntNit", query = "SELECT e FROM EntidadFinanciera e WHERE e.entNit = :entNit"), @NamedQuery(name = "EntidadFinanciera.findByEntNombre", query = "SELECT e FROM EntidadFinanciera e WHERE e.entNombre = :entNombre")})
public class EntidadFinanciera implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ent_nit")
    private Integer entNit;
    @Basic(optional = false)
    @Column(name = "ent_nombre")
    private String entNombre;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "entNit")
    private List<Producto> productoList;

    public EntidadFinanciera() {
    }

    public EntidadFinanciera(Integer entNit) {
        this.entNit = entNit;
    }

    public EntidadFinanciera(Integer entNit, String entNombre) {
        this.entNit = entNit;
        this.entNombre = entNombre;
    }

    public Integer getEntNit() {
        return entNit;
    }

    public void setEntNit(Integer entNit) {
        this.entNit = entNit;
    }

    public String getEntNombre() {
        return entNombre;
    }

    public void setEntNombre(String entNombre) {
        this.entNombre = entNombre;
    }

    public List<Producto> getProductoList() {
        return productoList;
    }

    public void setProductoList(List<Producto> productoList) {
        this.productoList = productoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (entNit != null ? entNit.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EntidadFinanciera)) {
            return false;
        }
        EntidadFinanciera other = (EntidadFinanciera) object;
        if ((this.entNit == null && other.entNit != null) || (this.entNit != null && !this.entNit.equals(other.entNit))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.src.uniandes.ecos.tsp.creditscore.entity.EntidadFinanciera[entNit=" + entNit + "]";
    }

}
